<template>
  <div data-component="Format">
    <!-- 基础格式化 -->
    <FormatBase :column="column" :scope="scope" />
    <!-- 产品名称/代码 -->
    <FormatProNameCode :column="column" :scope="scope" />
    <!--
      * 多行数据
      * 用法：columns传参 { format: 'multi', formatParams: [{每行属性}] }
      * 每行属性格式：{ prop: 字段名, format: number|time|dictionary, formatParams: 可选 }
    -->
    <template v-if="column.format === 'multi'">
      <div v-for="(item, index) in column.formatParams" :key="index" data-component="Format.multi">
        <FormatBase :column="item" :scope="scope" is-multi />
      </div>
    </template>
  </div>
</template>

<script>
import FormatBase from './FormatBase.vue';
import FormatProNameCode from './FormatProNameCode.vue';
export default {
  components: {
    FormatBase,
    FormatProNameCode
  },
  props: {
    scope: {
      type: Object,
      default: () => {}
    },
    column: {
      type: Object,
      default: () => {}
    }
  }
};
</script>
